#ifndef _SHA1_HASHING_
#define _SHA1_HASHING_

#include <stdint.h>
#include "HashingStrategy.hpp"


class SHA1hashing : public HashingStrategy {

    private:

        uint32_t _intermediate_hash[5]; // Message Digest
        uint32_t _length_low;           // Message length in bits
        uint32_t _length_high;          // Message length in bits

        uint8_t _message_block[64];     // 512-bit message blocks
        uint8_t _message_block_index;   // Index into message block array

        void process_message_block( void );
        void pad_message( void );
        inline void add_length_to_context( size_t length );

        static inline uint32_t sha_ch( uint32_t a, uint32_t b, uint32_t c );
        static inline uint32_t sha_parity( uint32_t a, uint32_t b, uint32_t c );
        static inline uint32_t sha_maj( uint32_t a, uint32_t b, uint32_t c );

    public:

        SHA1hashing(void);
        ~SHA1hashing(void);

        void process(const uint8_t *message_array, size_t length);
        void finalize(void);

};

#endif
